package com.rzj.sys_lab_assistant.service.impl;

import com.rzj.sys_lab_assistant.dao.AssistantSubsidyMapper;
import com.rzj.sys_lab_assistant.entity.AssistantSubsidy;
import com.rzj.sys_lab_assistant.service.IAssistantSubsidyService;
import com.rzj.sys_lab_assistant.utils.TimeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @program: sys_lab_assistant
 * @description:
 * @author: 作者
 * @create: 2021-07-02 22:02
 */
@Service
public class AssistantSubsidyServiceImpl implements IAssistantSubsidyService {

    @Autowired
    AssistantSubsidyMapper assistantSubsidyMapper;

    TimeUtils timeUtils;

    @Override
    public List<AssistantSubsidy> assistantSubsidiesList(int aId) {
        return assistantSubsidyMapper.listAssistantSubsidies(aId);
    }

    @Override
    public List<AssistantSubsidy> assistantSubsidiesByIdList(String account) {
        return assistantSubsidyMapper.listAssistantSubsidiesById(account);
    }

    @Override
    public AssistantSubsidy getAssistantSubsidyById(int id) {
        return assistantSubsidyMapper.getAssistantSubsidyById(id);
    }

    @Override
    public int saveAssistantSubsidy(AssistantSubsidy assistantSubsidy) {
        assistantSubsidy.setCreateTime(timeUtils.getTime());
        assistantSubsidy.setModifyTime(timeUtils.getTime());
        return assistantSubsidyMapper.saveAssistantSubsidy(assistantSubsidy);
    }

    @Override
    public int updateAssistantSubsidy(AssistantSubsidy assistantSubsidy) {
        assistantSubsidy.setModifyTime(timeUtils.getTime());
        return assistantSubsidyMapper.updateAssistantSubsidy(assistantSubsidy);
    }

    @Override
    public int deleteAssistantSubsidy(int id) {
        return assistantSubsidyMapper.deleteAssistantSubsidy(id);
    }
}
